package main

import "fmt"

func main() {
	noBlockReceive()
}

// 非阻塞接收数据 select + block
func noBlockReceive() {
	// c1 c2 同时收，谁来的快收谁
	var c1, c2 chan int
	// c1,c2 = nil
	select {
	case n := <-c1:
		fmt.Println("received from c1", n)
	case n := <-c2:
		fmt.Println("received from c2", n)
	default:
		fmt.Println("no value received!")
	}
}
